package com.happy.cat.project.system.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.happy.cat.framework.aspectj.lang.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;


/**
 * 优惠券管理对象 cat_coupon
 * 
 * @author verne
 * @date 2020-07-18
 */
@Data
@ToString
@EqualsAndHashCode
@NoArgsConstructor
@Accessors(chain = true)
@TableName(autoResultMap = true )
@ApiModel(value="优惠券管理对象", description="优惠券管理对象数据")
public class CatCoupon implements Serializable {

private static final long serialVersionUID=1L;


    /** ID */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /** 优惠券名称 */
    @Excel(name = "优惠券名称")
    @ApiModelProperty(value = "优惠券名称")
    private String name;

    /** 可用品类 */
    @Excel(name = "可用品类")
    @ApiModelProperty(value = "可用品类")
    private Integer couponType;

    /** 总发行量 */
    @Excel(name = "总发行量")
    @ApiModelProperty(value = "总发行量")
    private Integer couponNumber;

    /** 面额 */
    @Excel(name = "面额")
    @ApiModelProperty(value = "面额")
    private BigDecimal couponMoney;

    /** 使用门槛 */
    @Excel(name = "使用门槛")
    @ApiModelProperty(value = "使用门槛")
    private Integer sill;

    /** 元可用 */
    @Excel(name = "元可用")
    @ApiModelProperty(value = "元可用")
    private BigDecimal sillMoney;

    /** 有效类型 */
    @Excel(name = "有效类型")
    @ApiModelProperty(value = "有效类型")
    private Integer expirationType;

    @TableField(typeHandler = FastjsonTypeHandler.class)
    @ApiModelProperty(value = "有效期限区间")
    private List<Date> expirationTimes = new ArrayList<>();

    /** 有效值 */
    @Excel(name = "有效值")
    @ApiModelProperty(value = "有效值")
    private String expirationVal;

    /** 技能品类 */
    @Excel(name = "技能类型")
    @ApiModelProperty(value = "技能类型")
    private Integer skillType;

    @TableField(typeHandler = FastjsonTypeHandler.class)
    @ApiModelProperty(value = "技能品类")
    private List<Integer> skillCategoryIds = new ArrayList<>();

    /** 备注 */
    @Excel(name = "备注")
    @ApiModelProperty(value = "备注")
    private String remarks;

    /** 创建时间 */
    @Excel(name = "创建时间" , width = 30, dateFormat = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "创建时间")
    private Date createDate;

    /** 创建人 */
    @ApiModelProperty(value = "创建时间")
    private String createBy;

    /** 状态 */
    @Excel(name = "状态")
    @ApiModelProperty(value = "状态")
    private Integer status;


    @TableField(exist = false)
    @ApiModelProperty(value = "是否过期")
    private Date now;

    public Date getExpired() {
        return new Date();
    }

    public void setExpired(Date now) {
        this.now = now;
    }

}
